package DataStruction;

import java.util.Stack;
import java.util.TreeSet;

public class Set {
    public static void main(String[] args) {
        treeSet();
    }

    public static void treeSet() {

        TreeSet<Student> set = new TreeSet<Student>();
        Stack<Student> students = new Stack<>();
        Student student1 = new Student("洛天依", 25);
        Student student2 = new Student("洛依", 16);
        Student student3 = new Student("天依", 18);
        Student student4 = new Student("洛天", 20);
        set.add(student1);
        set.add(student2);
        set.add(student3);
        set.add(student4);
        students.push(student1);
        students.push(student2);
        students.push(student3);
        students.push(student4);
        for (Student s : set) {
            System.out.print(s + " ");
        }
        for (Student student : students) {
            System.out.println(student);
        }
        System.out.println(students.search(student1));
    }
}
